package cn.jx.cjm.common.util;

import cn.jx.cjm.common.aop.annotation.LockerService;
import cn.jx.cjm.common.contants.CommonCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author James Chen right_way@foxmail.com
 * @version 1.0
 * <p>
 *
 * </p>
 * @since 2020/10/28 23:28
 */
@Component
public class LockUtils {

    @Autowired
    private LockerService lockerService;

    public void removeLock(){
        if (LockerService.LOCK_KEY.get() != null) {
            lockerService.unlock(LockerService.LOCK_KEY.get());
        }
        LockerService.LOCK_KEY.remove();
        if (CommonCache.departmentIds.get() != null) {
            CommonCache.departmentIds.remove();
        }
    }
}
